home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / New System Software Extensions / QuickDraw™ GX v1.0ß2 / Interfaces & Libraries / graphics libraries / font library.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-29  |  19.1 KB  |  494 lines  |  [TEXT/MPS ]

  1. /* graphics:    
  2.     gxFont library routines
  3.     by Cary Clark, Georgiann Delaney, Michael Fairman, Dave Good, Robert Johnson, Keith McGreggor, Mike Reed, Oliver Steele, David Van Brink, Chris Yerga
  4.     Copyright ©1987 - 1991 Apple Computer, Inc.  All rights reserved.
  5. */
  6.  
  7.     #include <Memory.h>
  8.     #include <QuickDraw.h>
  9.  
  10. #include "font library.h"
  11. #include "graphics libraries.h"
  12. #include "font routines.h"
  13.     #include "graphics toolbox.h"
  14.  
  15. #pragma options(signed_pstrs)   /* for Think C 5.0 */
  16. #ifdef MacintoshIncludes
  17.     #define NewString gNewString
  18. #endif
  19.  
  20. typedef struct {
  21.     gxFont        fontID;
  22.     char*   fullName;
  23. } fontNameRecord;
  24.  
  25. static fontNameRecord commonFonts[] = {
  26.     { nil, "Chicago" },
  27.     { nil, "Courier" },
  28.     { nil, "Geneva" },
  29.     { nil, "Helvetica" },
  30.     { nil, "Monaco" },
  31.     { nil, "New York" },
  32.     { nil, "Symbol" },
  33.     { nil, "Times Roman" }
  34. };
  35.  
  36.  
  37. /***********************************
  38.  *  gxShape and gxStyle library routines to handle  fonts *
  39.  ***********************************/
  40.  
  41. gxFont GetCommonFont(commonFontEnum fontIndex)
  42. {
  43.     if (fontIndex >= firstCommonFont && fontIndex <= lastCommonFont)
  44.     {   if (commonFonts[fontIndex].fontID == nil)
  45.             commonFonts[fontIndex].fontID = FindCNameFont(gxFullFontName, commonFonts[fontIndex].fullName);
  46.         return commonFonts[fontIndex].fontID;
  47.     }
  48.     return GXGetDefaultFont();
  49. }
  50.  
  51. void SetShapeCommonFont(gxShape s, commonFontEnum fontIndex)
  52. {
  53.     GXSetShapeFont(s, GetCommonFont(fontIndex));
  54. }
  55.  
  56. void SetStyleCommonFont(gxStyle s, commonFontEnum fontIndex)
  57. {
  58.     GXSetStyleFont(s, GetCommonFont(fontIndex));
  59. }
  60.  
  61. static long CLength(const char *name)
  62. {
  63.     const char *nameEnd = name;
  64.     
  65.     while (*nameEnd++);
  66.     return nameEnd - name - 1;
  67. }
  68.  
  69. gxFont FindCNameFont(gxFontName meaning, const char* name)
  70. {
  71.     gxFont fontID = nil;
  72.     GXFindFonts(0, meaning, gxMacintoshPlatform, gxRomanScript, gxEnglishLanguage, CLength(name), (unsigned char *) name, 1, 1, &fontID);
  73.     return fontID;
  74. }
  75.  
  76. gxFont FindPNameFont(gxFontName meaning, const unsigned char name[])
  77. {
  78.     gxFont fontID = nil;
  79.     GXFindFonts(0, meaning, gxMacintoshPlatform, gxRomanScript, gxEnglishLanguage, name[0], &name[1], 1, 1, &fontID);
  80.     return fontID;
  81. }
  82.  
  83. /************ gxFont names *************/
  84.  
  85. long FindFontCName(gxFont fontID, gxFontName meaning, char name[])
  86. {
  87.     long length = GXFindFontName(fontID, meaning, gxMacintoshPlatform, gxRomanScript, gxEnglishLanguage, (unsigned char*)name, nil);
  88.  
  89.     if (name)
  90.         name[length] = 0;
  91.     return length;
  92. }
  93.  
  94. long FindFontPName(gxFont fontID, gxFontName meaning, unsigned char name[])
  95. {
  96.     long length = GXFindFontName(fontID, meaning, gxMacintoshPlatform, gxRomanScript, gxEnglishLanguage, &name[1], nil);
  97.  
  98.     if (name)
  99.         name[0] = length;
  100.     return length;
  101. }
  102.  
  103. long FindStyleFontCName(gxStyle s, gxFontName meaning, char name[])
  104.  {
  105.     gxFont fontID = GXGetStyleFont(s);
  106.     return(FindFontCName(fontID, meaning, name));
  107.  }
  108.  
  109. long FindStyleFontPName(gxStyle s, gxFontName meaning, unsigned char name[])
  110.  {
  111.     gxFont fontID = GXGetStyleFont(s);
  112.     return(FindFontPName(fontID, meaning, name));
  113.  }
  114.  
  115. void SetStylePNamedFont(gxStyle s, const unsigned char name[])
  116. {
  117.     gxFont fontID = FindPNameFont(gxFullFontName, name);
  118.     if (fontID != GXGetStyleFont(s))
  119.         GXSetStyleFont(s, fontID);
  120. }
  121.  
  122. void SetStyleCNamedFont(gxStyle s, const char* name)
  123. {
  124.     gxFont fontID = FindCNameFont(gxFullFontName, name);
  125.     if (fontID != GXGetStyleFont(s))
  126.         GXSetStyleFont(s, fontID);
  127. }
  128.  
  129. /************************
  130.  *  Routines for using GXFindFonts
  131.  ************************/
  132.  
  133. long CountFontFamilies(void)
  134. {
  135.     return GXFindFonts(nil, gxFamilyFontName, 0, 0, 0, 0, nil, 1, gxSelectToEnd, nil);
  136. }
  137.  
  138. gxFont FindFontFamily(long index, gxFontPlatform platform, gxFontScript script, gxFontLanguage language,
  139.     long nameLength, const unsigned char *name)
  140. {
  141.     gxFont fontID = nil;
  142.     GXFindFonts(nil, gxFamilyFontName, platform, script, language, nameLength, name, index, 1, &fontID);
  143.     return fontID;
  144. }
  145.  
  146. long CountFontStyles(gxFont family)
  147. {
  148.     return GXFindFonts(family, 0, 0, 0, 0, 0, nil, 1, gxSelectToEnd, nil);
  149. }
  150.  
  151. static gxFont GetFontStyle(gxFont family, long index)
  152. {
  153.     gxFont fontID = nil;
  154.     GXFindFonts(family, 0, 0, 0, 0, 0, nil, index, 1, &fontID);
  155.     return fontID;
  156. }
  157.  
  158. gxFont FindFontStyle(gxFont family, long index, gxFontPlatform platform, gxFontScript script, gxFontLanguage language,
  159.     long nameLength, const unsigned char *name)
  160. {
  161.     gxFont fontID = nil;
  162.  
  163.     if (index)
  164.         GXFindFonts(family, 0, 0, 0, 0, 0, nil, index, 1, &fontID);
  165.     else
  166.         GXFindFonts(family, gxStyleFontName, platform, script, language, nameLength, name, index, 1, &fontID);
  167.     return fontID;
  168. }
  169.  
  170. /****************************
  171.         Style matching routines
  172.  ****************************/
  173.  
  174. typedef struct {
  175.     fixed       minValue;
  176.     fixed       defaultValue;
  177.     fixed       maxValue;
  178. } descriptorRange;
  179.  
  180. typedef struct {
  181.     descriptorRange weight;
  182.     descriptorRange width;
  183.     descriptorRange slant;
  184. } fontMatchDescriptor;
  185.  
  186. typedef struct {
  187.     fixed       weight;
  188.     fixed       width;
  189.     fixed       slant;
  190. } fontStyleCoord;
  191.  
  192. /*********************************************/
  193. /*              PrepareStyleForMatching                 */
  194. /*  this sets the styles gxFont variations to that of the current gxFont    */
  195. /*  we'll use this as a master and keep it to do our matching off of    */
  196. /*  if the gxStyle already has variations then we'll check to see if  */
  197. /*  the gxFont has axes, if not we'll nuke the variations and set new */
  198. /*  ones based upon the 'fdsc' information(GXFindFontDescriptor should*/
  199. /*  look at the fond header for old type fonts      ???         */
  200. /*********************************************/
  201. static void PrepareStyleForMatching(gxStyle aStyle)
  202. {
  203.     fontStyleCoord coord;
  204.     gxFont fontID = GXGetStyleFont(aStyle);
  205.     
  206.     coord.weight = 1;
  207.     coord.width = 1;
  208.     coord.slant = 0;
  209.  
  210.     GXFindFontDescriptor(fontID, weightVariationTag, &coord.weight);  
  211.     GXFindFontDescriptor(fontID, widthVariationTag, &coord.width);    
  212.     GXFindFontDescriptor(fontID, slantVariationTag, &coord.slant);    
  213.  
  214.     //if (!( GXGetStyleFontVariations(aStyle, nil)))
  215.     {   gxFontVariation* variations = (gxFontVariation*)NewPtr(3 * sizeof(gxFontVariation));
  216.         {   variations[0].name = weightVariationTag;    /*will actually check to see if current variations are set*/
  217.             variations[0].value = coord.weight; /*then we'll append any needed ones*/
  218.             variations[1].name = widthVariationTag; /*need a new routine that will set and create if needed*/
  219.             variations[1].value = coord.width;
  220.             variations[2].name = slantVariationTag;
  221.             variations[2].value = coord.slant;
  222.         }
  223.         GXSetStyleFontVariations(aStyle, 3, variations);
  224.         DisposPtr((Ptr)variations);
  225.     }
  226. }
  227.  
  228. /*
  229.  *  This builds a complete description of a gxFont as it is being used in a gxStyle.
  230.  *  Use this to compare against the styles in another gxFont family, to find the closest match.
  231.  */
  232. static void BuildFontStyleCoord(gxStyle aStyle, fontStyleCoord* coord)
  233. {
  234.     gxFont fontID = GXGetStyleFont(aStyle);
  235.     long i, count;
  236.     fixed value;
  237.     gxFontTableTag aTag;
  238.  
  239.     coord->weight = 1;
  240.     coord->width = 1;
  241.     coord->slant = 0;
  242.  
  243.     GXFindFontDescriptor(fontID, weightVariationTag, &coord->weight); 
  244.     GXFindFontDescriptor(fontID, widthVariationTag, &coord->width);   
  245.     GXFindFontDescriptor(fontID, slantVariationTag, &coord->slant);   
  246.     
  247.     if (count = GXGetStyleFontVariations(aStyle, nil))
  248.     {   gxFontVariation* variations = (gxFontVariation*)NewPtr(count * sizeof(gxFontVariation));
  249.         GXGetStyleFontVariations(aStyle, variations);
  250.         for (i = 0; i < count; i++)
  251.         {   aTag = variations[i].name;
  252.             value = variations[i].value;
  253.             if (aTag == weightVariationTag)
  254.                 coord->weight = value;
  255.             else if (aTag == widthVariationTag)
  256.                 coord->width = value;
  257.             else if (aTag == slantVariationTag)
  258.                 coord->slant = value;
  259.         }
  260.         DisposPtr((Ptr)variations);
  261.     }
  262. }
  263.  
  264. /*
  265.  *  This builds a complete description of a gxFont, giving its ranges for the various styles
  266.  *      weight, width, slant.
  267.  *  If the gxFont does not support a range for a given gxStyle, then min = max = default.
  268.  */
  269. static void BuildFontMatchDescriptor(gxFont fontID, fontMatchDescriptor* descriptor)
  270. {
  271.  
  272.     descriptor->weight.minValue = descriptor->weight.defaultValue = descriptor->weight.maxValue = 0;
  273.     descriptor->width.minValue = descriptor->width.defaultValue = descriptor->width.maxValue = 0;
  274.     descriptor->slant.minValue = descriptor->slant.defaultValue = descriptor->slant.maxValue = 0;
  275.  
  276.     if (GXFindFontDescriptor(fontID, weightVariationTag, &descriptor->weight.defaultValue))
  277.         descriptor->weight.minValue = descriptor->weight.maxValue = descriptor->weight.defaultValue;
  278.     if (GXFindFontDescriptor(fontID, widthVariationTag, &descriptor->width.defaultValue))
  279.         descriptor->width.minValue = descriptor->width.maxValue = descriptor->width.defaultValue;
  280.     if (GXFindFontDescriptor(fontID, slantVariationTag, &descriptor->slant.defaultValue))
  281.         descriptor->slant.minValue = descriptor->slant.maxValue = descriptor->slant.defaultValue;
  282.  
  283.     GXFindFontVariation(fontID, weightVariationTag, &descriptor->weight.minValue, &descriptor->weight.defaultValue, &descriptor->weight.maxValue, nil);
  284.     GXFindFontVariation(fontID, widthVariationTag, &descriptor->width.minValue, &descriptor->width.defaultValue, &descriptor->width.maxValue, nil);
  285.     GXFindFontVariation(fontID, slantVariationTag, &descriptor->slant.minValue, &descriptor->slant.defaultValue, &descriptor->slant.maxValue, nil);
  286. }
  287.  
  288. /*
  289.  *  This needs to scale each difference by some amount that balances the various styles
  290.  *      weight, width, slant
  291.  *  This could be a global table, or possible gxFont defined?
  292.  */
  293. static fixed ComputeDescriptorMetric(fontStyleCoord* coord, fontMatchDescriptor* descriptor, fontStyleCoord* setting, fontStyleCoord* remaining)
  294. {
  295.     fixed distance = 0;
  296.     fontStyleCoord remainBuffer;
  297.  
  298.     if (remaining == nil)
  299.         remaining = &remainBuffer;
  300.  
  301.     remaining->weight = remaining->width = remaining->slant = 0;
  302.                                                                 /*setting must fall within the range of descriptor min and max*/
  303.     setting->weight = (coord->weight < descriptor->weight.maxValue) ? coord->weight: descriptor->weight.maxValue;/* min of the maximums*/
  304.     setting->weight = (setting->weight > descriptor->weight.minValue) ? setting->weight: descriptor->weight.minValue;/* max of the minimums*/
  305.     remaining->weight = coord->weight - setting->weight;    /* if positive then we need to add more bolding with a textface, if negative we need to take some away*/
  306.     distance += (remaining->weight > 0) ? FixedMultiply(remaining->weight , prefwghtweighting): -FixedMultiply(remaining->weight , prefwghtweighting);/*absolute value for distance metric */
  307.     
  308.     setting->width = (coord->width < descriptor->width.maxValue) ? coord->width: descriptor->width.maxValue;/* min of the maximums*/
  309.     setting->width = (setting->width > descriptor->width.minValue) ? setting->width: descriptor->width.minValue;/* max of the minimums*/
  310.     remaining->width = coord->width - setting->width;   /* if positive then we need to extend via textface, if negative we need to condense*/
  311.     distance += (remaining->width > 0) ? FixedMultiply(remaining->width , prefwdthweighting): -FixedMultiply(remaining->width , prefwdthweighting);/*absolute value for distance metric  */
  312.  
  313.     setting->slant = (coord->slant < descriptor->slant.maxValue) ? coord->slant: descriptor->slant.maxValue;/* min of the maximums*/
  314.     setting->slant = (setting->slant > descriptor->slant.minValue) ? setting->slant: descriptor->slant.minValue;/* max of the minimums*/
  315.     remaining->slant = coord->slant - setting->slant;   /* if positive then we need to skew clockwise via textface, if negative we need to skew counter clockwise*/
  316.     /*actually, if there is any slant at all in the coord->slant then we don't want to make an italic gxFont more italic*/
  317.     distance += (remaining->slant > 0) ? FixedMultiply(remaining->slant, prefslntweighting): -FixedMultiply(remaining->slant, prefslntweighting);/*absolute value for distance metric  this is naturally weighted to be last pref*/
  318.     /* could use something like this and then weight it??? distance += FixedDivide(remaining->slant, ff(90) ); */
  319.     if(setting->slant)
  320.         remaining->slant = 0;
  321.  
  322.     return distance;
  323. }
  324.  
  325. static void AppendVariation(gxFontVariation** variation, gxFontTableTag aTag, fixed value)
  326. {
  327.     gxFontVariation* var;
  328.     long size = GetHandleSize((Handle)variation);
  329.     
  330.     SetHandleSize((Handle)variation, size + sizeof(gxFontVariation));
  331.     var = (gxFontVariation*)((char*)*variation + size);
  332.     var->name = aTag;
  333.     var->value = value;
  334. }
  335.  
  336. static void CreateCoordVariations(fontStyleCoord* setting, fontMatchDescriptor* descriptor, gxFontVariation* variation)
  337. {
  338.     long count = 0;
  339.  
  340.     if (setting->weight != descriptor->weight.defaultValue)
  341.     {   variation[count].name = weightVariationTag;
  342.         variation[count].value = setting->weight;
  343.         count++;
  344.     }
  345.     if (setting->width != descriptor->width.defaultValue) count++;
  346.     {   variation[count].name = widthVariationTag;
  347.         variation[count].value = setting->width;
  348.         count++;
  349.     }
  350.     if (setting->slant != descriptor->slant.defaultValue) count++;
  351.     {   variation[count].name = slantVariationTag;
  352.         variation[count].value = setting->slant;
  353.         count++;
  354.     }
  355. }
  356.  
  357. /*  currently CreateCoordTextFace makes up the difference between the variation axes and the actual settings of the old gxStyle*/
  358. static gxTextFace* CreateCoordTextFace(fontStyleCoord* remainingCoord, fontMatchDescriptor* descriptor, fontStyleCoord* setting)
  359. {
  360.     #pragma unused(setting)
  361.     
  362.     gxTextFace* newFace;
  363.     fixed newBoldAddition = 0;
  364.     
  365.     newFace = (gxTextFace*)NewPtr(sizeof(gxTextFace) +  (1 - gxAnyNumber) * sizeof(gxFaceLayer));
  366.     newFace->faceLayers = 1;
  367.     ResetMapping(&newFace->advanceMapping);
  368.  
  369.     newFace->faceLayer[0].outlineStyle = nil;
  370.     newFace->faceLayer[0].outlineFill = gxSolidFill;
  371.     newFace->faceLayer[0].flags = 0;
  372.     /*X=default length, Y = desired percentage bold, x = setting weight, y =new percentage bold to apply*/
  373.     /*  y = XY/x    */      /*newBoldAddition = FixedDivide( FixedMultiply(remainingCoord->weight, descriptor->weight.defaultValue), setting->weight);*/
  374.      if ( (remainingCoord->weight) && (descriptor->weight.defaultValue == fixed1) ) /*if there is bold left and the gxFont is not natuarally bold*/
  375.         /*newBoldAddition = FixedDivide( FixedMultiply(remainingCoord->weight, descriptor->weight.defaultValue), setting->weight);*/
  376.         newBoldAddition = fixed1/12;  /*this is just a temporary hack until textfaces are nailed down????*/
  377.     newBoldAddition *= (remainingCoord->weight > 0) ? 1: -1;    /*increase or decrease weight*/
  378.     newFace->faceLayer[0].boldOutset.x = newBoldAddition;   /*if negative this makes lighter???*/
  379.     newFace->faceLayer[0].boldOutset.y = 0;
  380.  
  381.     if (remainingCoord->width || remainingCoord->slant)
  382.     {   gxTransform curTransform = newFace->faceLayer[0].outlineTransform = GXNewTransform();
  383.         if (remainingCoord->width)
  384.         {   fixed newWidthFactor = fixed1+ remainingCoord->width;
  385.             GXScaleTransform(curTransform, newWidthFactor, fixed1, 0, 0);
  386.         }
  387.         if (remainingCoord->slant)
  388.             GXSkewTransform(curTransform, -fixed1/4, 0, 0, 0);/*should do a slope from angle????*/
  389.     }
  390.     else
  391.         newFace->faceLayer[0].outlineTransform = nil;
  392.     return newFace;
  393. }
  394.  
  395. static gxFont FindMatchingFont(gxStyle currentStyle, gxFont targetFamily, gxFontVariation* newVariations, gxTextFace** newFace)
  396. {
  397.     fixed bestMetric = ff(32767);
  398.     gxFont bestFont = targetFamily;
  399.     fontStyleCoord currentCoord, bestRemaining, bestSetting;
  400.     fontMatchDescriptor bestDesc;
  401.     long styleIndex, styleCount;
  402.  
  403.     BuildFontStyleCoord(currentStyle, ¤tCoord);   /*maybe take this out later??? use preparestyleformatching*/
  404.  
  405.     styleCount = CountFontStyles(targetFamily);
  406.     for (styleIndex = 1; styleIndex <= styleCount; styleIndex++)
  407.     {   fixed metric;
  408.         gxFont targetFont = GetFontStyle(targetFamily, styleIndex);
  409.         fontStyleCoord remainingCoord, targetSetting;
  410.         fontMatchDescriptor targetDescriptor;
  411.  
  412.         BuildFontMatchDescriptor(targetFont, &targetDescriptor);
  413.         if(!GXGetFont(targetFont, nil, nil))
  414.             DebugStr((const unsigned char *)"\pError in FindMatchingFont with targetFont");
  415.         metric = ComputeDescriptorMetric(¤tCoord, &targetDescriptor, &targetSetting, &remainingCoord);
  416.         if (metric < bestMetric)
  417.         {   bestMetric = metric;
  418.             bestFont = targetFont;
  419.             bestDesc = targetDescriptor;
  420.             bestSetting = targetSetting;
  421.             bestRemaining = remainingCoord;
  422.         }
  423.     }
  424.     if (newVariations)  /*new way we won't have to do this?????*/
  425.         CreateCoordVariations(&bestSetting, &bestDesc, newVariations);
  426.     if (newFace)
  427.         *newFace = bestMetric ? CreateCoordTextFace(&bestRemaining, &bestDesc, &bestSetting) : nil;
  428.  
  429.     return bestFont;
  430. }
  431.  
  432. static void DisposeFaceParts(gxTextFace *newFace)
  433. {
  434.     long activeLayer = newFace->faceLayers - 1;
  435.  
  436.     do {
  437.         if (newFace->faceLayer[activeLayer].outlineStyle)
  438.             GXDisposeStyle(newFace->faceLayer[activeLayer].outlineStyle);
  439.         if (newFace->faceLayer[activeLayer].outlineTransform)
  440.             GXDisposeTransform(newFace->faceLayer[activeLayer].outlineTransform);
  441.     } while (--activeLayer >= 0);
  442.     DisposPtr((Ptr) newFace);
  443. }
  444.  
  445.  
  446. void SetMatchingStyle(gxFont targetFamily, gxStyle theStyle, long matchInfo)
  447. {
  448.     gxFont toFont;
  449.     gxTextFace *newFace = nil;
  450.     gxFontVariation newVariations[3];/*will only match on wght, wdth, slnt*/
  451.     gxFont fromFont = GXGetStyleFont(theStyle);
  452.     boolean toggle = false;
  453.     
  454.     if ( !( GXGetStyleFontVariations(theStyle, nil)) )
  455.         PrepareStyleForMatching(theStyle);
  456.     if(matchInfo & useTextFaceMatching)
  457.     {
  458.         if(matchInfo & useVariationsMatching)
  459.             toFont = FindMatchingFont(theStyle, targetFamily, newVariations, &newFace);
  460.         else
  461.             toFont = FindMatchingFont(theStyle, targetFamily, nil, &newFace);
  462.     }
  463.     if(!(matchInfo & useTextFaceMatching))
  464.     {
  465.         if(matchInfo & useVariationsMatching)
  466.             toFont = FindMatchingFont(theStyle, targetFamily, newVariations, nil);
  467.         else
  468.             toFont = FindMatchingFont(theStyle, targetFamily, nil, nil);
  469.     }
  470.  
  471.     
  472.     GXSetStyleFont(theStyle, toFont);
  473.     GXSetStyleFace(theStyle, nil);    /*remove any textfaces set  will have to do this selectively in the future???*/
  474.     
  475.     if(matchInfo & useVariationsMatching)
  476.     {   short varCount;
  477.         if(varCount = GXCountFontVariations(toFont))
  478.             GXSetStyleFontVariations(theStyle, varCount, newVariations);
  479.     }
  480.     if(matchInfo & useTextFaceMatching)
  481.     {
  482.         if(newFace)
  483.             GXSetStyleFace(theStyle, newFace);
  484.     }   
  485.     if (newFace)
  486.         DisposeFaceParts(newFace);
  487. }
  488.  
  489. gxStyle ReturnMatchingStyle(gxFont targetFamily, gxStyle theStyle, long matchInfo)
  490. {   gxStyle aStyle = GXCopyToStyle(nil, theStyle);
  491.     SetMatchingStyle(targetFamily, aStyle, matchInfo);
  492.     return(aStyle);
  493. }
  494.